首页>代码>springMVC+Mybatis+Spring+Easyui+zTree+ueditor+highchart企业IT信息管理系统>/IT_M - 副本/src/com/gree/ssm/controller/DepartController.java
package com.gree.ssm.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.gree.ssm.po.Depart; import com.gree.ssm.service.DepartService; /** * 部门 * * @author Administrator * */ @Controller @RequestMapping("/depart") public class DepartController { @Autowired private DepartService departService; @RequestMapping("/opDepart") public String opDepart(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "depart/departList"; } @RequestMapping("/add") public @ResponseBody Map<String, Object> add(Model model, Depart depart) { Map<String, Object> re = new HashMap<String, Object>(); boolean result = departService.add(depart); if (result) { re.put("success", true); re.put("msg", "添加成功"); } else { re.put("success", false); re.put("msg", "添加失败"); } return re; } @RequestMapping("/update") public @ResponseBody Map<String, Object> update(Model model, Depart depart) { Map<String, Object> re = new HashMap<String, Object>(); boolean result = departService.update(depart); if (result) { re.put("success", true); re.put("msg", "修改成功"); } else { re.put("success", false); re.put("msg", "修改失败"); } return re; } @RequestMapping("/query") public @ResponseBody Map<String, Object> query(HttpServletRequest request, HttpServletResponse response, String dName, Integer page, Integer rows) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); PageInfo<Depart> pageInfo = departService.findListByNamePage(dName, page, rows); re.put("total", pageInfo.getTotal()); re.put("rows", pageInfo.getList()); return re; } @RequestMapping("/queryAll") public @ResponseBody List<Depart> queryAll(HttpServletRequest request, HttpServletResponse response, String dName) throws Exception { if (dName != null) dName = new String(dName.getBytes("ISO-8859-1"), "UTF-8"); List<Depart> departs = departService.findListByNameAll(dName); return departs; } /** * 删除 * * @return */ @RequestMapping("/delete") public @ResponseBody Map<Object, Object> delete(Integer[] ids) { Map<Object, Object> re = new HashMap<Object, Object>(); boolean result = departService.deleteByIds(ids); if (result) { re.put("success", true); re.put("msg", "删除成功"); } else { re.put("success", false); re.put("msg", "删除失败"); } return re; } }
最近下载更多
zhaoyangwfd LV17
2022年1月20日
wanglinddad LV55
2022年1月19日
543666826 LV33
2021年11月18日
2231788897 LV6
2021年10月20日
lewis365 LV2
2021年8月22日
ericxu1116 LV24
2021年6月7日
幸运疯子 LV13
2021年5月16日
小屁孩 LV7
2021年4月11日
skipple3 LV39
2020年11月26日
ddqddqddq LV14
2020年9月5日
最近浏览更多
李俊雄 LV3
5月8日
educationAAA LV6
5月2日
wahaha9zz
4月25日
暂无贡献等级
xiaozhi丶 LV14
4月10日
爱丽淇 LV5
3月13日
pangzhihui LV13
3月1日
qq1633 LV6
2月19日
heshao LV2
2月7日
Gin19960217 LV4
1月12日
zhangjilu LV18
1月7日